package org.ogv.usada.models;

import java.util.Random;

import org.ogv.CAssetManager.AssetDeclaration;
import org.ogv.OGV;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Json;

public class GP {
	private static GP _$;
	public static final GP $() {
		if(_$ == null) {
			_$ = new Json().fromJson(GP.class, Gdx.files.internal("data/params.ctn"));
		}
		return _$;
	}
	
	public int GAME_WIDTH = 1280;
	public int GAME_HEIGHT= 800;
	
	public Random RANDOM = new Random();
	
	public float GAME_GRAVITY 		= -400.0f;
	public float GAME_SLICE_LIFETIME= 0.5f;
	public float GAME_LEAF_SPEED	= 800;
	public Color GAME_COIN_FONTCOLOR;
	public Color GAME_BGCOLOR;
	public float GAME_POT_SPLASH_LIFETIME;
	public int GAME_CUST_ANGRY_SCORE = -70;
	public int GAME_LEAF_WRONG_SCORE = -20;

	public float SOUND_VOL	= 1;
	public float MUSIC_VOL	= 1;

	public int STATE_GAME 			= 0;
	public int STATE_START 			= 1;
	public int STATE_GAMEOVER 		= 2;
	public int STATE_LEVEL_SELECT 	= 3;
	public int STATE_SPLASH		 	= 4;
	
	public float TOUCH_OFFSET_Y;
	
	public boolean DEBUG_DRAW;

	public AssetDeclaration ASSETS_NONGAME;
	public AssetDeclaration ASSETS_RESIDENT;

	public String RES_SOUND_KACHING		= "data/audio/kaching.ogg";
	public String RES_SOUND_RECIPEFAIL	= "data/audio/gagal.ogg";
	public String RES_SOUND_CLICK		= "data/audio/click.ogg";
	public String RES_FONT_PRINTCLEARLY = "data/font/pc.fnt";
	public String RES_TEXR_SLICE[] 		= new String[]{"data/pack", "slice"};
	public String RES_TEXR_CLOCK_BG[] 	= new String[]{"data/pack", "clock-bg"};
	public String RES_TEXR_CLOCK_POINT[]= new String[]{"data/pack", "clock-pointer"};
	public String RES_TEXR_MENU[]		= new String[]{"data/pack", "menu"};
	public String RES_TEXR_RECIPE[]		= new String[]{"data/pack", "ui-resep-27"};
	public String RES_TEXR_COIN[]		= new String[]{"data/pack", "ui-coin"};
	public String RES_TEXR_STAR[]		= new String[]{"data/pack", "star"};
	public String RES_TEXR_RECIPE_BG[]	= new String[]{"data/pack", "recipe-bg"};
	public String RES_TEXR_OPTION_BG[]	= new String[]{"data/pack-pause", "option"};
	public String RES_TEXR_OPT_SLIDER[]	= new String[]{"data/pack-pause", "option-slider"};
	public String RES_TEXR_OPT_RESUME[]	= new String[]{"data/pack-pause", "option-resume"};
	public String RES_TEXR_OPT_EXIT[]	= new String[]{"data/pack-pause", "option-exit"};
	public String RES_TEXR_START_BG[]	= new String[]{"data/pack-nongame", "start-bg"};
	public String RES_TEXR_HOWTO[][]	= new String[][]{
			new String[]{"data/pack-nongame","howto-0"},
			new String[]{"data/pack-nongame","howto-1"}, 
	};
	public String[] RES_TEXR_GAMEOVER_BG_0 		= new String[]{"data/pack-gameover","go-bg-0"};
	public String[] RES_TEXR_GAMEOVER_BG_1 		= new String[]{"data/pack-gameover","go-bg-1"};
	public String[] RES_TEXR_GAMEOVER_RETRY 	= new String[]{"data/pack-gameover","go-retry"};
	public String[] RES_TEXR_GAMEOVER_EXIT 		= new String[]{"data/pack-gameover","go-exit"};
	public String[] RES_TEXR_GAMEOVER_NEXT 		= new String[]{"data/pack-gameover","go-next"};
	public String[] RES_TEXR_GAMEOVER_THROPY	= new String[]{"data/pack-gameover","go-throphy"};
	public String RES_TEXR_GAMEOVER_MEDALS[][]	= new String[][]{
			new String[]{"data/pack-gameover","go-medal-gameover"},
			new String[]{"data/pack-gameover","go-medal-bronze"},
			new String[]{"data/pack-gameover","go-medal-silver"},
			new String[]{"data/pack-gameover","go-medal-gold"},
			new String[]{"data/pack-gameover","go-medal-perfect"},
	};
	public String[] RES_TEXR_LVSEL_BG	= new String[]{"data/pack-nongame","lvs-bg"};
	public String[] RES_TEXR_LVSEL_EXIT	= new String[]{"data/pack-nongame","lvs-exit"};
	public String[] RES_TEXR_LVSEL_STAR	= new String[]{"data/pack-nongame","lvs-star"};
	public String[] RES_TEXR_DOOR_R		= new String[]{"data/pack-pause","door-r"};
	public String[] RES_TEXR_DOOR_L		= new String[]{"data/pack-pause","door-l"};
	public String[] RES_TEXR_HOWTO_BTN_L= new String[]{"data/pack-pause","recipe-left"};
	public String[] RES_TEXR_HOWTO_BTN_R= new String[]{"data/pack-pause","recipe-right"};
	public String[] RES_TEXR_SPLASH		= new String[]{"data/pack-nongame","splash"};
	
	private Sound _clickSound;
	public void playClickSound() {
		if(_clickSound == null)
			_clickSound = OGV.asset.get(RES_SOUND_CLICK, Sound.class);
		_clickSound.play(SOUND_VOL * 0.6f);
	}
}
